package com.fsj.admin.system.service;


import com.fsj.admin.system.hystrix.RedisHystrix;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

//@FeignClient(name = "stip-cloud-redis", url = "http://localhost:8005", fallback = RedisHystrix.class)
@FeignClient(name = "stip-cloud-redis", url="http://stipcloudredis:8005", fallback = RedisHystrix.class)
@Service
public interface RedisService {

    @RequestMapping(method = RequestMethod.POST, value = "/cache/setCache", consumes = "application/json")
    Boolean setCache(@RequestParam("key") String key, @RequestParam(value = "value") String value);

    @RequestMapping(method = RequestMethod.GET, value = "/cache/getCache", consumes = "application/json")
    Object getCache(@RequestParam(value = "key") String key);

    @RequestMapping(method = RequestMethod.POST, value = "/cache/setCacheByTime", consumes = "application/json")
    Boolean setCacheByTime(@RequestParam(value = "key") String key, @RequestParam(value = "value") Object value, @RequestParam(value = "time") Long time);

    @RequestMapping(method = RequestMethod.POST, value = "/cache/removeCache", consumes = "application/json")
    Boolean removeCache(@RequestParam(value = "key") String key);

    @RequestMapping(method = RequestMethod.GET, value = "/cache/existsCache", consumes = "application/json")
    Boolean existsCache(@RequestParam(value = "key") String key);

    @RequestMapping(method = RequestMethod.POST, value = "/cache/setNx", consumes = "application/json")
    Boolean setNx(@RequestParam(value = "key") String key, @RequestParam(value = "value") String value, @RequestParam(value = "expireTime") Long expireTime);

}
